//品牌管理模块接口
import request from "@/utils/request";
import type { TradeMarkResponseData, TradeMark } from "./type";
enum API {
  //获取已有品牌的接口
  TRADEMARK_URL = "/admin/product/baseTrademark/",
  //添加品牌
  ADDTRADEMARK_URL = "/admin/product/baseTrademark/save",
  //修改品牌
  UPDATATRADEMARK_URL = "/admin/product/baseTrademark/update",
  //删除
  REMOVETRADEMARK_URL = "/admin/product/baseTrademark/remove/",
}
//获取已有品牌的接口
export const reqTradeMark = (page: number, limit: number) =>
  request.get<any, TradeMarkResponseData>(
    API.TRADEMARK_URL + `${page}/${limit}`
  );
//添加品牌修改品牌
export const reqAddOrUpdateTradeMark = (data: TradeMark) => {
  if (data.id) {
    return request.put<any, any>(API.UPDATATRADEMARK_URL, data);
  } else {
    return request.post<any, any>(API.ADDTRADEMARK_URL, data);
  }
};
//删除
export const reqRemoveTradeMark = (id: number) =>
  request.delete<any, any>(API.REMOVETRADEMARK_URL + id);
